<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <meta charset="UTF-8">
  <title>ART-Pi Smart Docs</title>
  <link rel="icon" href="_media/icon.png">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/vue.css">
</head>
<body>
  <div id="app"></div>
  <script>
    window.$docsify = {
      // coverpage: true, 
      auto2top: true,
      executeScript: true,
      loadNavbar: true,
      mergeNavbar: true,
      maxLevel: 4,
      subMaxLevel: 2,
      logo: '_media/icon.png height="130px"',
      name: '<span>ART-Pi Smart Docs</span>',
      search: {
        placeholder: '搜索',
        noData: '找不到结果!',
        depth: 3
      },
      formatUpdated: '{YYYY}-{MM}-{DD} {HH}:{mm}',
      plugins: [
        function (hook, vm) {
            hook.ready(function (){
            // true = show debug log
            let TARGET_QUERY = 'id'
            let SCROLL_DELAY = 1500 // in milisecond
            let location = window.location
            let currentUrlWithoutHash = new URL(
                    location.origin+location.pathname+
                    location.search+location.hash.substring(1)
            )
            let urlQueryParam = currentUrlWithoutHash.searchParams
            let isUrlHasIdQuery = urlQueryParam.has(TARGET_QUERY)
            if(isUrlHasIdQuery){
              let urlId = urlQueryParam.get(TARGET_QUERY)
              // run delayed, to make sure everything loaded
              setTimeout(function() {
                try{
                  if(window.localStorage.getItem(urlId)==undefined)
                  {
                    location.reload()
                    window.localStorage.setItem(urlId, '1');
                  }
                } catch(e){}
              }, SCROLL_DELAY);
              setTimeout(function(){
                window.localStorage.removeItem(urlId)
              },2000)
            }
          }),
          hook.beforeEach(function (html) {
            //获取浏览器基本属性
              var brower = navigator.userAgent;
            //如果不是google、火狐、指南针浏览器，就提示。
            if (brower.toLowerCase().indexOf("chrome")<0 && brower.toLowerCase().indexOf("firefox")<0 && brower.toLowerCase().indexOf("safari")<0){
              var msg = document.getElementById("msg");
              msg.innerHTML = "你的浏览器不兼容，请使用 Chrome,Firefox,Safari 等浏览器浏览。";
              document.getElementsByClassName("pt-message")[0].style.display = "block";
              setInterval('transTip()', 1000);
            }
            var url = 'https://gitee.com/ART-Pi/smart-website/blob/master/docs/' + vm.route.file
            var editHtml = '[:memo: Edit this page](' + url + ')\n\n'

            return '_Last modified {docsify-updated}_ ' +
              editHtml +
              html +
              '\n----\n' +
              '>Powered by [rt-thread](https://www.rt-thread.org/)'
          })
        }
      ]
    }
  </script>
  <script src="_scripts/docsify.min.js"></script>
  <script src="_scripts/search.min.js"></script>
  <script src="_scripts/emoji.min.js"></script>
  <script src="_scripts/prism-c.min.js"></script>
</body>
</html>
